chrome.extension.sendRequest({request: "probe", location: document.location}, callback);

function callback(response) {
  if (response.redirect) {
    document.location.protocol = "https";
  }
}